home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / database / powerbase / docs / ScriptFile < prev    next >
Encoding:
Text File  |  1997-02-21  |  8.1 KB  |  170 lines

  1.                         CH 12 − SCRIPT FILES
  2.                         ====================
  3. Powerbase incorporates a script language which lets you control some
  4. features from a script file. Using script files you can automate jobs which
  5. need to be done frequently. Print jobs are the most obvious example, and
  6. most of the script commands concern printing.  Script files are plain text
  7. files (created with Edit) and are executed by dragging them to the main
  8. Powerbase window. All commands in a script file must be in upper-case,
  9. preceded by “!”, and may be followed by a parameter, separated from the
  10. command by a single space. The following commands may be used (parameters in
  11. square brackets are optional):−
  12.  
  13. !SCRIPT All script files must begin with the line !SCRIPT POWERBASE. This
  14. enables the program to distinguish a script from other text files. You
  15. should make !SCRIPT END the last line of the file. The command can be made
  16. to “chain” another script file by following it with the name of the new
  17. file, i.e. by using the form !SCRIPT <filename>.
  18.  
  19. !COMMENT may be used to insert comments in a script file. The rest of the
  20. line after the command is ignored.
  21.  
  22. !SELECTION <filename>  where <filename> is the name of a selection file in
  23. the PrintRes directory, installs the selection as if you had dragged it from
  24. PrintRes to the Powerbase window yourself. If you issue the command without
  25. a parameter the current selection will be cleared.
  26.  
  27. !PRINTOPTS <filename>  where <filename> is the name of a print options file
  28. in the PrintRes directory, sets the print options just as if the the file
  29. had been dragged from PrintRes to the Powerbase window.  Issued without a
  30. parameter causes the default options to be set.
  31.  
  32. !QUERY [filename,]<search formula>  is used to print a list. It returns the
  33. same result as typing the search formula into the Print window and clicking
  34. Print. If you first issue a !DESTINATION File command you can use a script
  35. containing a list of !QUERY commands to create a batch of reports as text
  36. files. If the optional filename is omitted each file will be created in
  37. PrintJobs using the search formula (or its leftmost 10 characters) as the
  38. filename. If you supply a name containing $ it is assumed to be a full
  39. pathname and will be used to create the file. Any other name cuases the file
  40. to be created in PrintJobs or in a subdirectory (which must exist) of Print
  41. Jobs. !CASE and !INDEX also affect the behaviour of this command if issued
  42. beforehand.
  43.  
  44. !CSV  [filename,]<search formula>  resembles !QUERY but produces a CSV file
  45. instead. The CSV option settings are observed.  A !DESTINATION command is,
  46. of course, unnecessary.
  47.  
  48. !EXPAND is one of a number of commands used to select or deselect a switch
  49. in the Print options window. !EXPAND ON selects the switch which causes
  50. fields to be expanded by reference to a linked validation table. !EXPAND OFF
  51. (or just !EXPAND by itself) deselects the switch.
  52.  
  53. !DATE turns date and time stamping ON and OFF. It works in exactly the same
  54. way as !EXPAND.
  55.  
  56. !UPPER forces upper-case printing when followed by ON, normal upper/lower
  57. case printing otherwise.
  58.  
  59. !UNDERLINE turns underlining ON and OFF when output is sent to the printer.
  60. Underlining won’t be visible when the report is displayed in a window,  but
  61. will occur when the output is subsequently printed.
  62.  
  63. !CASE turns the Case switch on the Query panel ON and OFF.
  64.  
  65. !HEADER followed by ON causes header information (see 3.5) to be printed on
  66. reports.
  67.  
  68. !FIRST followed by ON causes the header to appear on the first page only.
  69.  
  70. !FOOTER followed by ON causes footer information (see 3.5) to be printed on
  71. reports.
  72.  
  73. !SHRINK followed by ON this removes surplus “white space” between the
  74. columns of reports in Vertical format.
  75.  
  76. !HEADINGS D causes descriptors to be used as field identifiers in a report.
  77. !HEADINGS T, or without any parameter, causes tags to be used.
  78.  
  79. !PITCH <n> sets the number of characters per inch for hard-copy printing to
  80. n, which  should be 5, 10, 12 or 17, representing double-width, pica, elite
  81. and condensed respectively.
  82.  
  83. !TITLE <string> uses <string> as a title on subsequently printed reports.
  84.  
  85. !PAGE <n> sets the page length for reports to n lines. 70 is correct for A4,
  86. 66 for American letter.
  87.  
  88. !LINESPACE <n> sets the line-spacing to n lines. The default is 1, i.e. no
  89. blank lines between lines of report. 2 gives double-spacing
  90.  
  91. !LMARGIN <n> sets the left margin to n character spaces.
  92.  
  93. !TMARGIN <n> sets the top margin to n lines.
  94.  
  95. !SPACER <string> specifies the string to be used to separate columns of
  96. printed data in reports using Horizontal or Table format.
  97.  
  98. !COLWIDTH <n> sets the width of the blank columns used in Table format to n
  99. spaces.
  100.  
  101. !FORMAT <string> where <string> is Horizontal, Vertical, Label or Table
  102. (N.B. case of <string> does not matter), sets the print format. In the last
  103. case the number of columns required must be appended as a second parameter,
  104. e.g. TABLE 8. If any other parameter is used, or !FORMAT is issued by
  105. itself, the Horizontal format is used.
  106.  
  107. !DESTINATION <string> where <string> is Window, File or Printer (N.B. case
  108. of <string> does not matter), sets the destination for report printing (see
  109. 3.1).  If File is used the report is saved in PrintJobs unless a subsequent
  110. !QUERY command supplies an alternative pathname (see above).
  111.  
  112. !LABEL is used to define a label specification to use with the LABEL format.
  113. It requires seven parameters, separated by commas:−
  114.  
  115. (1)     The number of labels across the page (1,2 or 3)
  116.  
  117. (2)     The horizontal label pitch (i.e. left edge to left edge) in inches.
  118.         This is only meaningful when  (1) is 2 or 3.
  119.  
  120. (3)     The vertical label pitch in inches.
  121.  
  122. (4)     The number of lines to be printed on each label.
  123.  
  124. (5)     The line which is to be replaced, if blank, by the last field in the
  125.         selection. If nothing is entered here (2 commas together) then no
  126.         substitution is performed.
  127.  
  128. (6)     If ON is entered the the primary key will appear on the label (in
  129.         brackets) as an identifier.
  130.  
  131. (7)     If ON is entered blank fields will be skipped when printing.
  132.  
  133. !DELETE <key> deletes the record whose primary key is <key>. Suppose you
  134. have a text file giving details of records to be deleted from the database.
  135. If such a job is needs doing often it might be worth writing a customised
  136. program to read the text file, generate the primary key of each record, then
  137. output the results as a script file with each key preceded by !DELETE. The
  138. whole batch can then be deleted by simply dragging the script into
  139. Powerbase. Not worthwhile for ten records, perhaps, but could be for a
  140. hundred. Note that all 6 subfiles will be searched for the records to be
  141. deleted.
  142.  
  143. !INSERT is the counterpart of !DELETE and is useful in similar
  144. circumstances. In this case the command must occupy a line by itself and be
  145. followed by the record to insert, one field to a line. It is the user’s
  146. responsibility to ensure that the lines are not too long for the database
  147. fields into which they are placed and that the number of lines following
  148. each !INSERT is the same as the number of fields in the record. Don’t forget
  149. to leave blank lines for empty fields!  Records will be inserted into the
  150. currently-selected subfile.
  151.  
  152. !CHANGE <field tag>,<old contents>,<new contents>[,<search formula>]  allows
  153. global changes to be made. The command functions like the Global changes
  154. menu choice (see 2.5.5).
  155.  
  156. !IMPRESSION , used in conjunction with !QUERY to generate a report in
  157. text-file format, allows you to insert Impression DDF* commands at the start
  158. of the text-file. A script may, for example, execute a series of !QUERY
  159. commands and the resulting files are to be all selected together and dragged
  160. into an Impression document. To make each file go into a new frame you need
  161. to make each begin with {nextframe}. This can be achieved by placing the
  162. script command !IMPRESSION {nextframe} before the first !QUERY. You do not,
  163. however, want {nextframe} to begin the first file created, or the Impression
  164. document will have a blank frame on its first page. To suppress the effect
  165. on the first file use the form:−
  166.  
  167. !IMPRESSION {nextframe} Not first
  168.  
  169. There must be a space between the “}” and the “N”, but the “Not first”
  170. string isn’t case sensitive.